const NodeMediaServer = require("node-media-server");

const NodeMediaServerConfig = {
  rtmp: {
    port: 1935,
    chunk_size: 60000,
    gop_cache: true,
    ping: 30,
    ping_timeout: 60,
  },
  http: {
    port: 8000,
    allow_origin: "*",
  },
};

const nms = new NodeMediaServer(NodeMediaServerConfig);
nms.on("prePublish", (id, StreamPath, args) => {
  // console.log('[NodeEvent on prePublish]', `id=${id} StreamPath=${StreamPath} args=${JSON.stringify(args)}`);
 
  console.log("\n\t");
  console.log("\n\t");
  console.log("++++++++++++ 1111: ", StreamPath);
});

nms.on("donePublish", (id, StreamPath, args) => {
  // console.log('[NodeEvent on donePublish]', `id=${id} StreamPath=${StreamPath} args=${JSON.stringify(args)}`);
  console.log("\n\t");
  console.log("\n\t");
  console.log("++++++++++++ 2222: ", StreamPath);
});



nms.run();
